/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.analysis.model;

import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

import net.groupme.logging.model.ActionIdentifier;

/**
 * created on Oct 4, 2007
 * 
 * Simple object that contains the search string and a list of resources the
 * user has visited afterwards...
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.1 $ $Date: 2007-10-05 13:56:10 $
 */
public class SearchAndClick {
	private String searchString = null;
	private ActionIdentifier action = null;
	private String userId = null;
	private String sessionId = null;
	private Date date = null;
	private List<String> resourcesVisited = null;
	/**
	 * Creates a new SearchAndClick instance. 
	 */
	public SearchAndClick() {
		super();
		this.resourcesVisited = new ArrayList<String>();
	}
	/**
	 * Creates a new SearchAndClick instance.
	 * @param searchString
	 * @param action
	 * @param userId
	 * @param sessionId
	 * @param date 
	 */
	public SearchAndClick(String searchString, ActionIdentifier action, String userId, String sessionId, Date date) {
		super();
		this.searchString = searchString;
		this.action = action;
		this.userId = userId;
		this.sessionId = sessionId;
		this.date = date;
		this.resourcesVisited = new ArrayList<String>();
	}
	/**
	 * This method returns the action of a SearchAndClick object.
	 * @return the action
	 */
	public ActionIdentifier getAction() {
		return action;
	}
	/**
	 * This method sets the action of a SearchAndClick object.
	 * @param action the action to set
	 */
	public void setAction(ActionIdentifier action) {
		this.action = action;
	}
	/**
	 * This method returns the date of a SearchAndClick object.
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}
	/**
	 * This method sets the date of a SearchAndClick object.
	 * @param date the date to set
	 */
	public void setDate(Date date) {
		this.date = date;
	}
	/**
	 * This method returns the resourcesVisited of a SearchAndClick object.
	 * @return the resourcesVisited
	 */
	public List<String> getResourcesVisited() {
		return resourcesVisited;
	}
	/**
	 * This method sets the resourcesVisited of a SearchAndClick object.
	 * @param resourcesVisited the resourcesVisited to set
	 */
	public void setResourcesVisited(List<String> resourcesVisited) {
		this.resourcesVisited = resourcesVisited;
	}
	/**
	 * This method adds a Resource ID to the list of visited resources.
	 * @param resourceID Resource ID to add
	 */
	public void addResourceVisited(String resourceID) {
		this.resourcesVisited.add(resourceID);
	}
	/**
	 * This method returns the searchString of a SearchAndClick object.
	 * @return the searchString
	 */
	public String getSearchString() {
		return searchString;
	}
	/**
	 * This method sets the searchString of a SearchAndClick object.
	 * @param searchString the searchString to set
	 */
	public void setSearchString(String searchString) {
		this.searchString = searchString;
	}
	/**
	 * This method returns the sessionId of a SearchAndClick object.
	 * @return the sessionId
	 */
	public String getSessionId() {
		return sessionId;
	}
	/**
	 * This method sets the sessionId of a SearchAndClick object.
	 * @param sessionId the sessionId to set
	 */
	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}
	/**
	 * This method returns the userId of a SearchAndClick object.
	 * @return the userId
	 */
	public String getUserId() {
		return userId;
	}
	/**
	 * This method sets the userId of a SearchAndClick object.
	 * @param userId the userId to set
	 */
	public void setUserId(String userId) {
		this.userId = userId;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		String result = "";
		result += this.sessionId + " - " + this.searchString + ": ";
		for(String re: this.resourcesVisited){
			result += re + ", ";
		}
		return result;
	}

}
